var btns = new Map();
btns.set(1, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(1,this)">分配设计师</button>')

btns.set(2, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(2,this)">提交图纸</button>')
btns.set(3, '<buttontype="button"  class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(3,this)">审核图纸</button>')
btns.set(4, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(4,this)">分配项目经理</button>')
btns.set(5, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(5,this)">分配监理</button>')
btns.set(6, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(6,this)">分配监理</button>')
btns.set(7, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(7,this)">通知材料备货</button>')
btns.set(8, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(8,this)">材料验收</button>')
btns.set(9, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal"  onclick="openLayer(9,this)">提交完工申请</button>')
btns.set(10, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(10,this)">监理验收</button>')
btns.set(11, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(11,this)">通知材料备货</button>')
btns.set(12, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(12,this)">材料验收</button>')
btns.set(13, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(13,this)">提交完工申请</button>')
btns.set(14, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(14,this)">监理验收</button>')
btns.set(15, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(15,this)">通知材料备货</button>')
btns.set(16, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(16,this)">>材料验收</button>')
btns.set(17, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(17,this)">提交完工申请</button>')
btns.set(18, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(18,this)">监理验收</button>')
btns.set(19, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal"  onclick="openLayer(19,this)">通知材料备货</button>')
btns.set(20, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(20,this)">材料验收</button>')
btns.set(21, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(21,this)">提交完工申请</button>')
btns.set(22, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(22,this)">监理验收</button>')
btns.set(23, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(23,this)">通知材料备货</button>')
btns.set(24, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(24,this)">材料验收</button>')
btns.set(25, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(25,this)">提交完工申请</button>')
btns.set(26, '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="openLayer(26,this)">监理验收</button>')
btns.set(27, '')

function openLayer(inPhase, a) {
    let url;
    let id;
    let title;
    let w;
    let h;
    var $1 = $(a);
    id = $1.prev().attr("data-id")
    url = "assign.html"
    if (inPhase == 1) {
        url = "designer/assign.html"
        title = "分配设计师"
        w = "600px"
        h = "500px"
    }
    if (inPhase == 2) {
        url = "/designer/upload.html"
        title = "提交图纸"
        w = "600px"
        h = "500px"
    }
    if (inPhase == 3) {
        url = "/designer/checkPics.html"
        title = "审核图纸"
        w = "1300px"
        h = "600px"
    }
    if (inPhase == 4) {
        url = "projectManager/manager.html"
        title = "分配项目经理"
        w = "600px"
        h = "500px"
    }
    if (inPhase == 5 || inPhase == 6) {
        url = "supervision/assign.html"
        title = "分配监理"
        w = "600px"
        h = "500px"
    }
    if (inPhase == 7 || inPhase == 11 || inPhase == 15 || inPhase == 19 || inPhase == 23) {
        url = "/onedecmaterials/replenishment.html"
        title = "选择材料"
        w = "600px"
        h = "500px"
    }
    if (inPhase == 8 || inPhase == 12 || inPhase == 16 || inPhase == 20 || inPhase == 24) {
        url = "material/acceptance.html"
        title = "材料验收"
        w = "1300px"
        h = "600px"
    }
    if (inPhase == 9 || inPhase == 13 || inPhase == 17 || inPhase == 21 || inPhase == 25) {
        $.ajax({
                url: "/project/project/updateProject",
                data: {
                    eId: 0,
                    projectNo: id,
                    status: inPhase + 1,
                },
                status: parseInt(inPhase) + 1,
                dataType: "json",
                type: "put",
                async: false,
                success: function (request) {
                    if (request.code == 200) {
                        layer.msg("验收申请提交成功，即将关闭页面");
                        setTimeout(function () {//设置定时器
                            location.reload(true);//刷新父级页面
                        }, 3000);
                    }
                }
            }
        )
        return;
    }
    if (inPhase == 10 || inPhase == 14 || inPhase == 18 || inPhase == 22||inPhase==26) {
        url = "supervision/acceptance.html"
        title = "监理验收"
        w = "1300px"
        h = "600px"
    }

    layui.use('layer', function () {
        console.log(w)
        var layer = layui.layer;
        layer.open({
            type: 2,
            title: title,
            shadeClose: true,
            shade: 0.8,
            area: [w, h],
            content: url + "?id=" + id + "&" + "inPhase=" + inPhase//iframe的url
        });
    });
}